/***************************************************************************
 * State Handler
 * -abstract super class for device handlers
 * -defines the necessary signals and methods a device handler would have to implement for GUI
 *                                                                         
 ***************************************************************************/

#ifndef STATEHANDLER_H
#define STATEHANDLER_H

#include <map>
#include <QObject>
#include "devices/InputPoint.h"
#include <map>
#include <qtransform.h>


class StateHandler : public QObject
{
    Q_OBJECT
public:
    virtual ~StateHandler(){}

public:

signals:
	void signalSaveState();
	void signalUnsave();
    void signalUpdateCursor(InputPoint p);
    void signalAddedInput(InputPoint p);
    void signalRemovedInput(int id, bool switchedCursors);
    void signalSelect(InputPoint p);
    void signalDeselect(InputPoint p);
    void signalMove(double dx, double dy);
	void signalScale(double perc);
	void signalRotate(double angle, Qt::Axis axis);
    void signalBrowseImportMenu(int direction);  /* LEFT == -1, RIGHT == 1 */
	void signalBrowseLoadMenu(int direction);  /* LEFT == -1, RIGHT == 1 */
	void signalLayer(int i); /* DOWN == 0, UP == 1 */
	void signalFlip(int i); /* HORZ == 0, VERT == 1 */

	void signalPrepareTransform(qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2);
	void signalTransform(qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2);

	void signalSetCursorRed(int id);
	void signalSetCursorGreen(int id);
	void signalRevertCursor1();
	void signalRevertCursor2();

	void signalDeviceConnected();

public slots:
    virtual void slotUpdateInputPoint(int id, InputState state) = 0;

protected:
	//map to hold the hand points
    std::map<int, InputPoint> m_inputs;
};

#endif // STATEHANDLER_H
